;(function  ($) {
	var myObj=function  () {
		var personInfo;//点击的列表
		var info;//点击列表显示对应的内容
		
		var personPhoto;
		var photo;
		
		var personDress;
		var dress;
		
		var codeInformation;
		var information;
		
		var aInfo;
		var a;

		var telBtn;
		var completeBtn;
		var complete;

		var righTonfirmTel;

		var countInfo;//点击“账号信息”返回账号信息页面

		var hreAllTel;//修改手机号的链接
		var rightTel;//修改手机号页面

		var hreAllPwd;//修改手机密码的链接
		var rightPwd;//修改手机页面

		var cityText;//文本框input
		var popSltBox;//input隐藏部分
		var firstSelect;//两个下拉框
		var secondSelect;
		var firstList;//第一个列表的div
		var secondList;//第二个列表的div
		var firstLi;//第一组Li
		var secondLi;//第二组Li
		var secondUl;//第二组的Ul
		var flag1 = true;//下拉框开关
		var flag2 = true;//同上
		var qixiaqu = ['摄山', '万寿', '马群街道', '仙林大学城', '迈皋桥/和燕路', '尧化门', '栖霞街道', '大成名店', '东城汇', '学则路'];
		var liuhequ = ['大厂', '雄州', '金宁广场', '龙池', '龙袍', '大厂十村', '阿尔卡迪亚', '平顶山路', '南钢', '新华东路', '新华西路', '玉桥市场'];
		var guluoqu = ['新街口地区', '湖南路', '三牌楼', '南大/南师大', '草场门/龙江', '环宇城', '新城市广场', '新城市/虹桥中心', '清江苏宁广场', '凤凰西街', '紫峰购物广场', '清凉门大街'];
		var qinhuiqu = ['夫子庙地区', '常府街/长白街', '升州路/集庆路', '瑞金路沿线', '苜蓿园', '秦虹村/中华门', '新街口地区'];
		var jianyequ = ['莫愁湖/水西门', '建邺万达', '奥体中心', '集庆门大街', '雨润大街', '南京国际博览中心/元通', '油坊桥', '应天大街/文体路'];
		var jiangningqu = ['开发区', '东山镇', '汤山镇', '禄口机场', '殷巷', '义乌小商品城', '竹山路沿线', '岔路口', '湖熟镇', '麒麟门', '铜山镇', '谷里', '砂之船奥莱', '江宁滨江开发区', '托乐嘉', '江宁金鹰', '河定桥', '百家湖', '江宁科学园'];
		var pukouqu = ['凤凰大街', '公园北路', '金浦购物中心', '老浦口1914', '大华家乐福', '明发城市广场', '高新区', '南大金陵学院', '威尼斯水城', '汤泉社区', '南京信息工程大学', '弘阳广场/新一城', '明发滨江', '澳林广场', '江浦', '天润城', '华侨城'];
		var yuhuataiqu = ['铁心桥/三江学院', '南京南站/明发', '安德门/小行', '西善桥', '虹悦城', '花生唐购物公园', '紫荆广场'];

		var leftLink;
		var leftLinka;

		var yuhua;
		var andemeng;
		var lione;
		var fuzhi;
		var changAdd;
		
		var loadEvent = function  () {
			ditujiaz();
			personInfo.on("click",showPerson);
			personPhoto.on("click",showPhoto);
			personDress.on("click",showDress);
			codeInformation.on("click",showInformation);
			leftLink.on("mouseover",changeColor);
			leftLink.on("mouseout",changeColorBack);
			hreAllTel.on("click",showTel);
			hreAllPwd.on("click",showPwd);
			countInfo.on("click",showInformation);
			telBtn.on("click",showConfrimtel);
			completeBtn.on("click",showComplete);
			
			cityText.on("focus",showText);//点击文本框显示隐藏
			cityText.on("blur",hideText);
			firstSelect.on("click",showFSelect);//显示第一个下拉框
			secondSelect.on("click",showSSelect);//显示第二个下拉框

			firstLi.on("click",firstInner);//关闭下拉框，并把选的值显示在文本框
			secondLi.on("click",secondInner);//同上
			
			
			}

		var lioneHandler = function  () {
			yuhua.html(lione.html());
//			alert(yuhua.html());
			
//			yuhua.html(lione.html());
//			lione.html();
//			alert(duzhi);
//			changAdd.html(fuzhi);

		}
		var ditujiaz=function  () {
			lione.click(function(){
			fuzhi=$(this).text();
			alert(fuzhi);
			changeAdd.val(fuzhi);

			 
			var map = new BMap.Map("sMap");
				map.centerAndZoom(new BMap.Point(118.778074408, 32.0572355018), 50);
				var local = new BMap.LocalSearch(map, {
					renderOptions: {
						map: map
					}
			});
//					alert(111);
			local.search(fuzhi);
			map.enableScrollWheelZoom(); //启用滚轮放大缩小，默认禁用
			map.enableContinuousZoom(); //启用地图惯性拖拽，默认禁用
			});
			
			$(".ainfo").click(function () {
					$(".pop-box").css("display","block");
					var map = new BMap.Map("sMap");
					map.centerAndZoom(new BMap.Point(118.778074408, 32.0572355018), 50);
					var local = new BMap.LocalSearch(map, {
						renderOptions: {
							map: map
						}
					});
//					alert(111);
					local.search(fuzhi);
					map.enableScrollWheelZoom(); //启用滚轮放大缩小，默认禁用
					map.enableContinuousZoom(); //启用地图惯性拖拽，默认禁用
				})
			
			
		}
		var showComplete = function () {
			complete.show();
			complete.siblings().hide();
		}

		var showTel = function () {
			rightTel.show();
			rightTel.siblings().hide();
		}

		var showConfrimtel = function () {
			righTonfirmTel.show();
			righTonfirmTel.siblings().hide();
		}

		var showPwd = function () {
			rightPwd.show();
			rightPwd.siblings().hide();
		}
		var showFSelect = function () {
				if(flag1){
					firstList.show();
					flag1 = !flag1;
				}else{
					firstList.hide();
					flag1 = !flag1;
				}

			}
		var showSSelect = function () {
				if(flag2){
					secondList.show();
					flag2 = !flag2;
				}else{
					secondList.hide();
					flag2 = !flag2;
				}
		}

		var showText = function () {
			popSltBox.show();
		}
		var hideText = function () {
			popSltBox.hide();
		}

		var firstInner = function () {
			firstSelect.html($(this).html()+"<i class='icon-tri-down'></i>");
			pushData($(this).html(),"栖霞区",qixiaqu);
			pushData($(this).html(),"六合区",liuhequ);
			pushData($(this).html(),"江宁区",jiangningqu);
			pushData($(this).html(),"浦口区",pukouqu);
			pushData($(this).html(),"鼓楼区",guluoqu);
			pushData($(this).html(),"秦淮区",qinhuiqu);
			pushData($(this).html(),"建邺区",jianyequ);
			pushData($(this).html(),"雨花台区",yuhuataiqu);
			firstList.hide();
		}

		//往页面当中塞值的方法
		var pushData = function (a,b,c) {//a:当前对象 ，b:区名 ，c:地名数组
			var arr = [];
			if(a === b){
				secondSelect.html(c[0]+"<i class='icon-tri-down'></i>");
				secondUl.html("");
				for(var i = 0;i<c.length;i++){
					arr.push("<li>"+c[i]+"</li>");
				}
				secondUl.html(arr);
				$(".secondList .slt-list li").on("click",secondInner);
			}
		}

		var secondInner = function () {
			secondSelect.html($(this).html()+"<i class='icon-tri-down'></i>");
			secondList.hide();

		}

		var changeColor = function () {
			$(this).children().children().css("color","white");
		}
		var changeColorBack = function () {
			$(this).children().children().css("color","black");
		}

		var showPerson = function  () {
			info.show();
			info.siblings().hide();
		}
		
		var showPhoto = function  () {
			photo.show();
			photo.siblings().hide();
		} 
		
		var showDress =function  () {
			dress.show();
			dress.siblings().hide();
		}
		
		var showInformation =function  () {
			information.show();
			information.siblings().hide();
		}


		//关闭地图
		$(function () {
			$(".close").click(function () {
				$(".pop-box").css("display","none");
			})
		})
		
		return{
			init:function  () {
				popSltBox = $(".pop-slt");
				cityText = $(".citytext");
				firstSelect = $(".firstSelect");
				secondSelect = $(".secondSelect");
				firstList = $(".firstList");//第一个列表div
				secondList = $(".secondList");//第二个列表的div
				firstLi = $(".firstList .slt-list li");
				secondLi = $(".secondList .slt-list li");
				secondUl = $(".secondList .slt-list ul");

				personInfo = $(".personInfo");
				info = $(".right-information");

				personPhoto = $(".personPhoto");
				photo = $(".right-person-imge");
				
				personDress =$(".personDress");
				dress = $(".right-dress");
				
				codeInformation =$(".codeInformation");
				information =$(".right-account");

				leftLink = $(".link");
				leftLinka = $(".link a");

				hreAllTel = $(".hreAll-tel");
				rightTel = $(".right-tel");

				hreAllPwd = $(".hreAll-pwd");
				rightPwd = $(".right-pwd");
				
				countInfo = $(".count-info");
				completeBtn = $(".complete-btn");
				complete = $(".complete");

				telBtn = $(".tel-btn");
				righTonfirmTel = $(".right-confirmTel");

				a =$("#aMap");
				
				yuhua = $("#yuhua");
				andemeng = $("#andemeng");
				lione = $("#changeone>li");
				changeAdd = $("#actaddress");
				
				loadEvent();
				
				
			}
		}
	}();
	myObj.init();
})(jQuery);
